package com.ubxtech.sms.listener;

import com.ubxtech.sms.bo.SmsEventBO;
import com.ubxtech.sms.service.SmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import jakarta.annotation.Resource;

/**
 * @author Victor.Xiao
 * @since 2023-05-15 20:35
 **/
@Component
@Slf4j
public class SmsListener {

    @Resource
    private SmsService smsService;

    @EventListener
    public void handleSmsEvent(SmsEventBO event) {

        if (log.isDebugEnabled()) {
            log.debug("监听到发送短信事件 handleSmsEvent:{}", event);
        }
        smsService.sendSms(event);
    }
}
